let loginBack = document.querySelector(".loginBack")
let loginButton = document.querySelector("#loginButton");
let accountInput = document.querySelector("#account");
let passwordInput = document.querySelector("#password");

//  正则检查
let phoneRegex = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/;
let emailRegex = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;

//  游客身份返回监听
loginBack.addEventListener("click", () => {
    utils.navigateTo("#userSpace")
});

//  登录事件监听
loginButton.addEventListener("click", (event) => {
    utils.navigateTo("#explore")
})

//  账号正则判断格式
accountInput.addEventListener('input', (event) => {
    let userInput =accountInput.value
    if (phoneRegex.test(userInput)) {
        console.log(`手机号`);
    } else if (emailRegex.test(userInput)) {
        console.log(`邮箱`)
    } else {
        console.log(`none`)
    }
})

/// TODO 登录发请求核心业务